
lst = [90, 99, 66, 89, 2, 30, 86]

def sort(lst):
    mid = len(lst)//2
    if len(lst)<2:
        return lst
    else:
        left = sort(lst[:mid])
        right = sort(lst[mid:])

        return merge(left, right)

def merge(left, right):
    result = []
    while left and right:
        if left[0] > right[0]:
            result.append(right.pop(0))
        else:
            result.append(left.pop(0))

    result = result+left+right
    return result


print(sort(lst))




